﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MayfairFramework.Common.Resource
{
    /// <summary>
    /// 
    /// </summary>
    public class Message
    {
        /// <summary>
        /// 
        /// </summary>
        private string key;

        /// <summary>
        /// 
        /// </summary>
        private string[] values;

        /// <summary>
        /// 
        /// </summary>
        /// <param name="key"></param>
        public Message(string key)
        {
            this.key = key;
            this.values = new string[0];
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="key"></param>
        /// <param name="values"></param>
        public Message(string key, params string[] values)
        {
            this.key = key;
            if (values == null)
            {
                this.values = new string[0];
            }
            else
            {
                this.values = new string[values.Length];
                for (int i = 0; i < this.values.Length; i++)
                {
                    this.values[i] = values[i];
                }
            }
        }

        /// <summary>
        /// 
        /// </summary>
        public string Key
        {
            get { return key; }
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            return string.Format(ResourceManager.GetString(key), values);
        }
    }
}
